﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ApprovalTests;
using ApprovalTests.Reporters;
using System.Diagnostics;

namespace SimpleApprovalsDemo
{
    [TestClass]
    public class SimpleTest
    {
        #region UsingAdd
        
        [TestMethod]
        public void TestAddToConsole()
        {
            var c = new BaseAdder(); 
            var result = c.Add(5, 6);
            Console.WriteLine(result);
        }
       
        [TestMethod]
        public void TestAddToAssert()
        {
            var c = new BaseAdder();
            var result = c.Add(5, 6);
            Assert.AreEqual(12,result);
        }

       
        [TestMethod]
        [UseReporter(typeof(ApprovalTests.Reporters.DiffReporter))]
        public void TestAddToApproval()
        {
            var c = new BaseAdder();
            var result = c.Add(5, 7);
            Approvals.Verify(result.ToString());

        }
        #endregion

        #region UsingExplain
        
        [TestMethod]
        [UseReporter(typeof(ApprovalTests.Reporters.DiffReporter))] 
        public void TestExplainToApproval()
        {
            var e = new BaseAdder();
            var result = e.Explain(5, 5);
            Approvals.Verify(result.ToString());

        }
        #endregion

        #region UsingReportersHTMLAndMore
        [TestMethod]
       //Show FileLauncherReporter (to render), then DiffReporter (to diff HTML)
        [UseReporter(typeof(ApprovalTests.Reporters.FileLauncherReporter))]
        public void TestLaunchReporterWithHTML()
        {
            string someHTML = "<html><body><h4>Cell that spans two columns:</h4><table border='1'><tr> <th>Name</th><th colspan='2'>Telephone</th></tr><tr><td>SoCalDevGal</td><td>555 77 854</td><td>555 77 855</td></tr></table><h4>Cell that spans two rows:</h4><table border='1'><tr><th>First Name:</th><td>SoCalDevGal</td></tr><tr><th rowspan='2'>Telephone:</th><td>555 77 854</td></tr><tr> <td>555 77 855</td></tr></table></body></html>";
            Approvals.VerifyHtml(someHTML.ToString());

        }

        #endregion
    }
}